from flask import Flask, render_template, Response, make_response, jsonify, url_for, redirect

app = Flask(__name__)


@app.route('/')
def hello_world():  # put application's code here
    # resp = Response(response='Python&Flask', status=201,
    #                 content_type='text/html;charset=utf-8')
    # return resp
    res = make_response(jsonify({'Python': 'Flask'}), 202)
    return res
    # return 'hello'


@app.route('/main/<num>', methods=['GET'])
def main(num):  # put application's code here
    return render_template('index.html', num=num)
#
#
@app.route('/hello/flask')
def greet():
    return redirect(url_for('hello_world'))  # 反向解析视图函数greet()对应的URL

if __name__ == '__main__':
    app.run()
